<!DOCTYPE html>
<html class="x-admin-sm">
{include file='public/header'}
<script src="/admin/xadmin/lib/layui/upload.js" charset="utf-8"></script>

<body>
    <div class="x-body">
        <form class="layui-form" lay-filter="formAjax">
            <div class="layui-form-item">
                <label class="layui-form-label">
                    <span class="x-red">*</span>发布者
                </label>
                <div id="pMenu" style="width:100%;flex:1"></div>
            </div>
            <div class="videoShow" style="display: none;">
                <div class="layui-form-item" style="display: flex;">
                    <label class="layui-form-label">
                        <span class="x-red">*</span>短剧
                    </label>
                    <div id="video_id" style="width:100%;flex:1"></div>
                </div>
            </div>

            <input type="hidden" name="id" id="id" value="" />
            <button id="submitData" class="layui-btn" lay-submit lay-filter="submitData" style="display: none;" />

        </form>
    </div>
    <script>
        let params = {
            addUrl: '/admin/other/add',
            editUrl: '/admin/other/edit',
            detailUrl: '/admin/other/detail',
        }
        form_ajax(params)
        let id = GetQueryString('id')
        let admin_uid = {
            url:'/admin/admin/select',
            elem: '#pMenu'
            , selected: []
            , tips: '选择发布者'
            , name: 'admin_uid'
            , field_id:'id'
            ,field_Name:'name'
        }
        let video_id = {
            url:'/admin/video/publisherVideoSelectList',
            elem: '#video_id'
            , selected: []
            , max:999
            , tips: '选择短剧'
            , name: 'video_id'
            , field_id:'id'
            ,field_Name:'name'
        }
        
        if (id) {
            Ajax(params.detailUrl, { id }).then(result => {
                admin_uid.selected = result.data.admin_uid.toString()
                selectN(admin_uid)
                video_id.selected = result.data.video_id
                showVideo(result.data.admin_uid)
            });
        } else {
            selectN(admin_uid)
        }
        function showVideo(value){
            video_id.url = '/admin/video/publisherVideoSelectList?admin_uid='+value
            selectM(video_id)
            $('.videoShow').show()
        }
        function infoSelectN(option,value){
            if(option.elem == '#pMenu'){
                showVideo(value)
            }
        }
    </script>
</body>

</html>